const loaderUtils = require('loader-utils');
const validateOptions = require('schema-utils');
const {JSDOM, VirtualConsole} = require('jsdom');
const path = require('path');

let schema = {
    'type': 'object',
    'properties': {
        'style': {
            'type': 'object',
            'properties': {
                'sass': {
                    'type': 'boolean'
                },
                'less': {
                    'type': 'boolean'
                },
                'stylus': {
                    'type': 'boolean'
                },
            }
        },
        'template': {
            'type': 'object',
            'properties': {
                'jade': {
                    'type': 'boolean'
                }
            }
        },
    },
    'errorMessage': {
        'option': 'should be {Boolean} (https:/github.com/org/repo#anchor)'
    },
    'additionalProperties': false
};
module.exports = function (content, map, meta) {
    let callback = this.async();
    let a = `a{color:red;&:hover{color:blue;}}`;
    console.log('styleloader');
    console.log(JSON.parse(content));
    let result = [
        'require("-!../stylelib/styleMiddle.js")(' + content + ')',
        // 'var source = require("-!css-loader!sass-loader!../stylelib/styleMiddle.js")',
        // '//require(' + loaderUtils.stringifyRequest(this, '!' + path.join(__dirname, './compiler/styleCompiler.js')) + ')(content)',
        // '//if(content.locals) module.exports = content.locals',
    ];
    callback(null, result.join(';'), map, meta);
};

